<?php 
	ob_start();
	require_once '../../../App_Code/Manage.php';
	
	$link=mysql_connect_default();
	{
		$MyLogin=new Manager();
		{
			$MyLogin->userid=$_POST['userid'];
			$MyLogin->password=strtoupper(md5($_POST['password']));
			$MyLogin->con=$link;
			$MyLogin->ToLogin();

			if($MyLogin->isLogin==true)
			{
				if($_POST['iscookie']=='true'){
					setcookie('Manager_Userid',$MyLogin->userid,time()+5184000,'/');				
					setcookie('Manager_Password',$MyLogin->password,time()+5184000,'/');					
				}
				else{
					setcookie('Manager_Userid',$MyLogin->userid,null,'/');				
					setcookie('Manager_Password',$MyLogin->password,null,'/');					
				}
				Extend::JsLocation('../../main.php');
				ob_end_flush();
			}
			else
			{
				if($MyLogin->state=='无用户'){
					Extend::JsAlert('用户名或密码错误!');
					Extend::JsHistory(-1);
				}
				else if($MyLogin->state=='密码错误')
				{				
					Extend::JsAlert('用户名或密码错误.');
					Extend::JsHistory(-1);								
				}
			}
		}
		$MyLogin=null;
	}
	mysql_close($link);
?>